#include <iostream>

#include <thread>
#include <future>

void Add(int num1, int num2, std::promise<int>& pro)
{
    pro.set_value(num1 + num2);
    return;
}

int main()
{
    std::promise<int> pro;
    std::future<int> fu = pro.get_future();
    std::thread th(Add, 11, 22, std::ref(pro));
    int sum = fu.get();
    std::cout << sum << std::endl;
    th.join();

    return 0;
}